package com.it.jiang.Dao;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data   //重写 getter 与 setter
@AllArgsConstructor  //有参构造
@NoArgsConstructor   //无参构造
@EqualsAndHashCode(callSuper = false)   //重写hash
@TableName("user")  //数据库的表名，当有驼峰命名的时候，TableName为最佳的选择
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId    //主键名称  https://baomidou.com/pages/223848/#tableid
    @TableField("id") //  https://baomidou.com/pages/223848/#tablefield
    private Long id;
    private String name;
    private Integer age;

    private String email;

    @Version    //version版本号 用于mp的乐观锁操作
    @TableField(fill = FieldFill.INSERT)   //这里执行的策略是，每次改变version都+1
    private Integer version;

    @EnumValue    //普通枚举类注解
    private  Enum  EnumVal ;

    @TableLogic(value = "1", delval = "0")   //1代表未删除 0代表删除
    private Integer delete;

    @TableField(fill = FieldFill.INSERT)   //添加数据时，填充数据
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)   //更新或者插入数据时，填充数据
    private Date updateTime;

}
